package cn.com.oidreams.common.dto;

import cn.com.oidreams.common.enums.ExceptionCode;
import lombok.Data;

/***
 ** @category 机器人的响应体
 ** @author qing.yunhui
 ** @email: qingyh@glodon.com
 ** @createTime: 2021-11-24 14:20
 **/
@Data
public class RobotResponse {

    /**
     * <p>成功标识</p>
     * */
    private static final String SUCCESS_CODE = "0";
    /**
     * <p>响应码</p>
     * */
    private String errcode=ExceptionCode.FAIL.getCode();
    /**
     * <p>响应消息</p>
     * */
    private String errmsg=ExceptionCode.FAIL.getValue();
    /**
     * <p>消息发送是否成功</p>
     * */
    private boolean isSuccess(){ return SUCCESS_CODE.equals(errcode); }
    public RobotResponse(){super();}
    public RobotResponse(String errcode, String errmsg) {
        this.errcode = errcode;
        this.errmsg = errmsg;
    }
    public RobotResponse(ExceptionCode exceptionCode){
        this(exceptionCode.getCode(),exceptionCode.getValue());
    }
}
